package cn.com.bonc.khjy.schedu;

import cn.com.bonc.khjy.controller.KafkaController;
import cn.hutool.log.Log;
import cn.hutool.log.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

import javax.annotation.PreDestroy;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;

/**
 * @author BTW
 */
@Component
public class FileDynamicScheduler implements ApplicationRunner {
    private final static Log log= LogFactory.get();

    @Autowired
    private FileFTPMonitor fileMonitor;


    @Override
    public void run( ApplicationArguments args ) throws InterruptedException {
        log.info("启动ftp文件传输线程.....");
        fileMonitor.toThreadStart();
    }

    @PreDestroy
    public void destroy(){
        log.debug("关闭ftp文件传输线程.....");
        fileMonitor.toThreadStop();
    }
}
